'use strict';

const Controller = require('egg').Controller;

class UserController extends Controller {
    async index() {
        this.ctx.body = 'aa';
    }
    *show() {
        console.log(this.ctx.model.User);
        let result = yield this.ctx.model.User.find({});
        console.log(result);
        this.ctx.body = result;
        this.ctx.status = 200;
        return result;
    }
    async add(){
        this.ctx.status = 200;
        this.ctx.body = await this.ctx.model.User.create({
            username: "ss",
            password: "cc"
        });

    }
    async ret(){
        this.ctx.status = 200;
        this.ctx.body ={
            message:1
        }
    }
}

module.exports = UserController;
